{extend name="layout:base" /}

{block name="content"}
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form">
                <input type="hidden" name="webID"  value="{$webID}"  autocomplete="off" class="layui-input">
                <div class="layui-row layui-col-space10 layui-form-item">
                    <label class="layui-form-label">关键词</label>
                    <div class="layui-input-block">
                        <textarea name="content" class="layui-textarea" style="width: 100%;min-height:300px;" lay-verify="required"></textarea>
                    </div>
                    <div class="layui-input-block">
                        格式(从EXCEL表中复制)：平台 关键词 首页价格 二页价格<br>
                        平台：1：百度------2：360-------3：百度移动端--------4：sogou-------5：神马
                    </div>
                </div>

                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0;">
                            <button class="layui-btn" lay-submit="" lay-filter="btnAdd">保存</button>
                            <a class="layui-btn layui-btn-primary" href="javascript:parent.location.reload();">返回</a>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script>
    layui.config({
        base: '__STATIC__/layuiadmin/' //静态资源所在路径
    }).extend({
        index: '/lib/index' //主入口模块
    }).use(['index', 'table','form'], function () {
        var $ = layui.$, form = layui.form;


        var wid={$webID};
        form.on('submit(btnAdd)', function (data) {
            $.post("{:url('add')}?webID="+wid, data.field, function (result) {
                console.log(result);
                if (result['code'] == 0) {
                    layer.msg(result['msg'], {icon: 1, time: 1000}, function () {
                        parent.location.reload();
                    });
                } else {
                    layer.msg(result['msg'], {icon: 3, time: 3000});
                }
            });
            return false;
        });
    });
</script>
{/block}